package com.mashibing.tank;

import lombok.ToString;

import java.awt.*;

/**
 * @description:
 * @author: 余希瑶
 * @date: 2021年06月22日 14:56
 * @version:1.0
 */
@ToString
public class Wall extends AbstractGameObject {
    private int x, y, w, h;
    private Rectangle rect;

    public Wall(int x, int y, int w, int h) {
        this.x = x;
        this.y = y;
        this.w = w;
        this.h = h;

        rect = new Rectangle(x, y, w, h);
    }

    public void paint(Graphics g) {
        Color color = g.getColor();
        g.setColor(Color.gray);
        g.fillRect(x, y, w, h);
        g.setColor(color);

//        Color c = g.getColor();
//        g.setColor(Color.yellow);
//        g.drawRect(rect.x,rect.y,rect.width,rect.height);
//        g.setColor(c);
    }

    public Rectangle getRect() {
        return rect;
    }

    @Override
    public boolean isLive() {
        return true;
    }
}
